import {Navigate} from "react-router-dom"
import {lazy} from "react";


import A from "../views/styled-components+style/A-v6.jsx"
import B from "../views/styled-components+style/B-v6.jsx"
import C from "../views/styled-components+style/C-v6.jsx"

import A1 from "../views/styled-components+style/a/A1.jsx"
import A2 from "../views/styled-components+style/a/A2.jsx"
import A3 from "../views/styled-components+style/a/A3.jsx"

// A模块的二级路由
const aRoutes = [
    {
        path: "/a",
        element: <Navigate to="/a/a1"/>
    }, {
        path: "/a/a1",
        name: "a-a1",
        element: <A1/>,

    },
    {
        path: "/a/a2",
        name: "a-a2",
        element: <A2/>,
    },
    {
        path: "/a/a3",
        name: "a-a3",
        element: <A3/>,

    },
]

// 一级路由
const routes = [
    {
        path: "/",
        element: <Navigate to="/a"/>
    }, {
        path: "/a",
        name: "a",
        element: <A/>,
        meta: {},
        children: aRoutes
    }, {
        path: "/b",
        name: "b",
        element: <B/>,
        meta: {}
    }, {
        path: "/c/:id?/:name?",
        name: "c",
        element: <C/>,
        meta: {}
    }, {
        path: "*",
        element: () => {
            return <Navigate to={{
                pathname: "/a",
                search: "?from=404"
            }}/>
        }
    }
]

export default routes